feat(redis): Support streaming spans#6083
Conversation
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. This PR will not appear in the changelog. 🤖 This preview updates automatically when you update the PR. |
Codecov Results 📊✅ 32 passed | Total: 32 | Pass Rate: 100% | Execution Time: 254ms All tests are passing successfully. ❌ Patch coverage is 9.76%. Project has 16342 uncovered lines. Files with missing lines (6)
Generated by Codecov Action |
Parametrize all tracing-related tests in the redis integration with `span_streaming` [True, False] so they exercise both the streaming and legacy (static) trace lifecycles. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Older redis-py versions (e.g. 4.6.0) emit an extra COMMAND span during RedisCluster initialization. Mirror the legacy branch's handling so the streaming assertion tolerates it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Missing exception handling around set_db_data_fn and _set_client_data in async client (sentry_sdk/integrations/redis/_async_common.py:147)
In _sentry_execute_command, the calls to set_db_data_fn(db_span, self) and _set_client_data(db_span, is_cluster, name, *args) are not wrapped in capture_internal_exceptions(). The synchronous counterpart in _sync_common.py wraps these calls (lines 147-149). If these functions raise an exception, it will propagate and could cause the Redis command to fail or leave spans unclosed, affecting user operations.
Identified by Warden find-bugs
Co-authored-by: sentry-warden[bot] <258096371+sentry-warden[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b52f66e. Configure here.
alexander-alderman-webb
left a comment
There was a problem hiding this comment.
LGTM! I haven't read every line of test change but the ones I looked at were good.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Description
Support span streaming in the Redis integration(s).
The following tags/extra are purposefully left out in the streaming path as they are non-standard and unused:
redis.commandsredis.transactionredis.is_clusterThe diff size looks terrifying but it's mostly tests 🙏🏻 The actual code changes are very straightforward.
Issues
Reminders
tox -e linters.feat:,fix:,ref:,meta:)